//
//  SignalDetailViewController.h
//  Portable Traffic Signal Assistor
//
//  Created by Hao Xu on 4/28/12.
//  Copyright (c) 2012 TTU. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>
#import "TimingPattern.h"
#import "SubSystem.h"
#import "Agency.h"
#import "Signal.h"
#import "XMLParser.h"
#import "TrafficSignalTimer.h"
#import <QuartzCore/QuartzCore.h>
#import <Foundation/Foundation.h>
//#import "SignalMovementImageManager.h"
#import "CustomizedBarButtonItem.h"
#import "DynamicIntersectionView.h"
#import "SignalAssistorDetailEditViewController.h"
#import "GeometryCalculation.h"
#import "DirectionSelectionPopupViewController.h"
#import "Intersection.h"
#import "TimeSpaceDirectionPage.h"
#import "GPSRecordListController.h"


@interface SignalDetailViewController : UIViewController<CLLocationManagerDelegate>
{
    int counter; //temporary parameter for debugging
}
@property (retain, nonatomic) IBOutlet UIButton *timeAdjustButton;

@property (nonatomic,retain) TimingPattern *timingPattern;
@property (nonatomic,retain) SubSystem *subSystem;
@property (nonatomic,retain) Agency *agency;
@property (retain,nonatomic) Signal *signal;
@property (retain,nonatomic) Intersection *intersection;
@property (nonatomic,retain) NSArray *signalList;
@property (assign) int signalIndex;
@property (retain, nonatomic) IBOutlet UILabel *SignalNameLabel;
@property (retain, nonatomic) IBOutlet UILabel *CycleLengthLabel;
@property (retain, nonatomic) IBOutlet UILabel *OffsetLabel;
@property (retain, nonatomic) IBOutlet UILabel *SignalTimerLabel;
//@property (retain, nonatomic) IBOutlet UILabel *Ring1CurrentPhaseLabel;
//@property (retain, nonatomic) IBOutlet UILabel *Ring1NextPhaseLabel;
//@property (retain, nonatomic) IBOutlet UILabel *Ring2CurrentPhaseLabel;
//@property (retain, nonatomic) IBOutlet UILabel *Ring2NextPhaseLabel;
@property (retain, nonatomic) IBOutlet UIButton *LastSignalButton;
@property (retain, nonatomic) IBOutlet UIButton *NextSignalButton;

@property (nonatomic) int timingRing1GraphPositionX;
@property (nonatomic) int timingRing2GraphPositionX;
@property (nonatomic,retain) NSTimer *timer;
@property (nonatomic,retain) NSMutableArray *labelList;
@property (retain, nonatomic) IBOutlet UILabel *mainCountDownLabel;

@property (nonatomic,retain) UILabel *cycleLabel;
@property (assign) int offsetPhaseTime;
//@property (nonatomic,retain) SignalMovementImageManager *signalMovementImageManager;
@property (nonatomic,retain) DynamicIntersectionView *dynamicIntersectionView;
@property (nonatomic) int lastMainCountDownNumber;
@property (nonatomic) BOOL automaticPlayOrNot;
@property (nonatomic,assign) CLLocationManager *locationManager;
@property (nonatomic) BOOL automaticDirection;
@property (nonatomic) BOOL adjustTimeBool;

- (id) initWithNibNameAndSignal:(NSString *)nibName agency:(Agency *)agency subSystem:(SubSystem *)subSystem timingPattern:(TimingPattern *)timingPattern signal:(Signal *)signal bundle:(NSBundle *)nibBundle;

- (id) initWithNibNameAndSignal:(NSString *)nibName agency:(Agency *)agency subSystem:(SubSystem *)subSystem timingPattern:(TimingPattern *)timingPattern signalList:(NSArray *)signalList signalIndex:(int)signalIndex automaticPlayOrNot:(BOOL)automaticPlayorNot bundle:(NSBundle *)nibBundle;
- (IBAction)clickNextButton:(id)sender;


- (IBAction)clickLastButton:(id)sender;

- (IBAction)clickTimeAdjustButton:(id)sender;




@end
